import request from './request';

// 获取提成分类列表
export function getCommissionCategoryList(params) {
  return request({
    url: '/api/umm/commission-categories/',
    method: 'get',
    params
  });
}

// 获取单个提成分类
export function getCommissionCategory(id) {
  return request({
    url: `/api/umm/commission-categories/${id}/`,
    method: 'get'
  });
}

// 新增提成分类
export function createCommissionCategory(data) {
  return request({
    url: '/api/umm/commission-categories/',
    method: 'post',
    data
  });
}

// 更新提成分类
export function updateCommissionCategory(id, data) {
  return request({
    url: `/api/umm/commission-categories/${id}/`,
    method: 'put',
    data
  });
}

// 删除提成分类
export function deleteCommissionCategory(id) {
  return request({
    url: `/api/umm/commission-categories/${id}/`,
    method: 'delete'
  });
}

// 导出提成分类数据
export function exportCommissionCategories(params) {
  return request({
    url: '/api/umm/commission-categories/export/',
    method: 'get',
    params,
    responseType: 'blob'
  });
}

// 获取导入模板
export function getImportTemplate() {
  return request({
    url: '/api/umm/commission-categories/import_template/',
    method: 'get',
    responseType: 'blob'
  });
}

// 导入提成分类数据
export function importCommissionCategories(data) {
  return request({
    url: '/api/umm/commission-categories/import_data/',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
} 